package com.example.administrator.test.personal;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.example.administrator.test.R;
import com.example.administrator.test.fragment.FragmentMyFansDriver;
import com.example.administrator.test.fragment.FragmentMyFansPassenger;

/**
 * Created by Administrator on 2016/11/28.
 */
public class MyFansActivity extends AppCompatActivity {
    private FragmentManager  manager;
    private FragmentTransaction transaction;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_myfans);
        manager=getSupportFragmentManager();
        transaction=manager.beginTransaction();
        transaction.add(R.id.layout_fragment_myfans,new FragmentMyFansDriver());
        transaction.commit();
    }
    public void clickMyFans(View view){
        switch (view.getId()){
            case R.id.rb_myfans_driver:
                manager=getSupportFragmentManager();
                transaction=manager.beginTransaction();
                transaction.replace(R.id.layout_fragment_myfans,new FragmentMyFansDriver());
                transaction.commit();
                break;
            case R.id.rb_myfans_passenger:
                manager=getSupportFragmentManager();
                transaction=manager.beginTransaction();
                transaction.replace(R.id.layout_fragment_myfans,new FragmentMyFansPassenger());
                transaction.commit();
                break;
        }
    }
    public void clickBack(View view){
        onBackPressed();
    }
}
